package com.ztf.receivetask;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Test;

public class ReceiveTaskTest {
    @Test
    public void testDeploy(){
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        processEngine.getRepositoryService()
                .createDeployment()
                .addClasspathResource("com/itheima09/activiti5/receivetask/receivetask.bpmn")
                .deploy();
    }

    @Test
    public void testStartPI(){
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        ProcessInstance pi = processEngine.getRuntimeService()
                //.startProcessInstanceByKey(processDefinitionKey)  根据pdkey启动流程实例  默认根据最高版本的启动
                .startProcessInstanceById("receive:1:4804");
        System.out.println(pi.getId());
        System.out.println(pi.getProcessInstanceId());
        System.out.println(pi.getProcessDefinitionId());
    }

    @Test
    public void testExecutionNext(){
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        processEngine.getRuntimeService()
                .signal("4901");//executionID="4901"是为了确定流程实例的
    }
}
